package com.test.pattern.combination;

/**
 * @ClassName: MenuComponent
 * @description: 菜单组件,抽象根节点
 * @author: Mr du
 * @create: 2024-02-25 15:28
 */
public abstract class MenuComponent {

    //菜单组件名称
    protected String name;

    //菜单组件层级
    protected int level;

    //添加子菜单
    public void add(MenuComponent menuComponent){
        throw new UnsupportedOperationException();
    }

    //移除子菜单
    public void remove(MenuComponent menuComponent){
        throw new UnsupportedOperationException();
    }

    //获取指定的子菜单
    public MenuComponent getChild(int index){
        throw new UnsupportedOperationException();
    }

    //获取菜单名称
    public String getName(){
        return name;
    }

    public abstract void print();
}
